package com.zqk.principle.openclose;

import java.math.BigDecimal;

/**
 * @Package com.zqk.principle.openclose
 * @Description:TODO
 * @Author 张乾坤
 * @Create: 2018/10/25
 * @Version 1.0
 * @Update: message
 */
public class JavaDiscountCourse extends JavaCourse {
    public JavaDiscountCourse(Integer id, String name, Double price) {
        super(id, name, price);
    }

    public Double getDiscountPrice(){

        if( super.getprice()>300) {
            BigDecimal bd1 = new BigDecimal(Double.toString(super.getprice()));
            BigDecimal bd2 = new BigDecimal(Double.toString(0.8));
            return bd1.multiply(bd2).doubleValue();

        }
        return super.getprice();
    }
}
